package edu.kit.csl.cratylus.extraction.elki;

import java.util.ArrayList;
import java.util.HashSet;

import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest;
import de.lmu.ifi.dbs.elki.algorithm.clustering.DBSCAN;
import de.lmu.ifi.dbs.elki.data.Cluster;
import de.lmu.ifi.dbs.elki.data.Clustering;
import de.lmu.ifi.dbs.elki.data.model.Model;
import de.lmu.ifi.dbs.elki.database.Database;
import de.lmu.ifi.dbs.elki.database.StaticArrayDatabase;
import de.lmu.ifi.dbs.elki.datasource.filter.ObjectFilter;
import de.lmu.ifi.dbs.elki.distance.distancevalue.IntegerDistance;
import de.lmu.ifi.dbs.elki.index.IndexFactory;
import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil;
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization;

/**
 * This is just a class for experiments with ELKI.. Can be removed in 
 * productive environments.
 */
public class ElkiTester  extends AbstractSimpleAlgorithmTest{

	/**
	 * @param args
	 */
	public static void main(String[] args) {
	    // Setup algorithm
	    ListParameterization params = new ListParameterization();
	    params.addParameter(DBSCAN.EPSILON_ID, new IntegerDistance(1));
	    params.addParameter(DBSCAN.MINPTS_ID, 1);
	    params.addParameter(DBSCAN.DISTANCE_FUNCTION_ID, LevenshteinDistanceFunction.class);
	    DBSCAN<ElkiCandidate, IntegerDistance> dbscan = ClassGenericsUtil.parameterizeOrAbort(DBSCAN.class, params);
	    
	    Database dbb = new StaticArrayDatabase(
	    		new CandidateDatabaseConnection( new ArrayList<ObjectFilter>()),
	    			new HashSet<IndexFactory<?, ?>>());
	    dbb.initialize();
	    Clustering<Model> result = dbscan.run(dbb);
	    System.out.println("res:" + result.toString());
	    for (Cluster<Model> cl : result.getAllClusters()) {
	    	System.out.println("cl:" + cl.toString());
	    }
	}

}
